import { format } from 'silly-datetime';

export const currentMonthMixins = {
    methods: {
        getCurrentMonthFirst () {
            const date = new Date();
            date.setDate(1);
            return format(date, 'YYYY-MM-DD');
        },
        getCurrentMonthLast () {
            const date = new Date();
            let currentMonth = date.getMonth();
            let nextMonth = ++currentMonth;
            let nextMonthFirstDay = new Date(date.getFullYear(), nextMonth, 1);
            let oneDay = 1000 * 60 * 60 * 24;
            return format(new Date(nextMonthFirstDay - oneDay), 'YYYY-MM-DD');
        }
    }
}
;
